package com.jiangxjsy.core.exception;

import com.jiangxjsy.core.wrap.ResultCode;

/**
 * wukong-crm-master
 * 蒋胜宇
 * 2025/5/30 16:07
 */

public class BasicException extends RuntimeException implements ResultCode {
    private final int code;
    private final String msg;

    public BasicException(int code, String msg) {
        super(code + ":" + msg, null, true, true);
        this.code = code;
        this.msg = msg;
    }

    public BasicException(ResultCode resultCode) {
        this(resultCode.getCode(), resultCode.getMsg());
    }

    /**
     * 获取状态码
     *
     * @return 状态码
     */
    @Override
    public int getCode() {
        return code;
    }

    /**
     * 获取状态码信息
     *
     * @return 状态码信息
     */
    @Override
    public String getMsg() {
        return msg;
    }
}
